Skip to content

Conversation

@nischitpra
Copy link
Collaborator

@nischitpra nischitpra commented Nov 3, 2025

Summary by CodeRabbit

  • New Features
    • Added a configuration option to control reorg validation behavior. The feature is enabled by default and can be toggled via an environment variable.

@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

A new configuration flag EnableReorgValidation is added to control reorg validation. The RunReorgValidator function checks this flag and returns early if disabled. A ClickHouse query is updated to select chain_id alongside existing block header fields and removes the FINAL modifier from the blocks table query.

Changes

Cohort / File(s) Summary
Configuration
configs/config.go
Added public field EnableReorgValidation bool to Config struct with environment variable ENABLE_REORG_VALIDATION and default value true
Feature Gating
internal/committer/reorg.go
Added early return in RunReorgValidator when EnableReorgValidation is false, short-circuiting reorg validation execution
Query Update
internal/libs/clickhouse.go
Modified GetBlockHeadersForReorgCheck query to select chain_id in addition to block_number, hash, and parent_hash; removed FINAL modifier from blocks table, using standard WHERE clause instead

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify that the common.Block struct has a chain_id field to accommodate the additional column in the query result mapping
  • Confirm that removing the FINAL modifier from the ClickHouse query does not introduce unexpected behavior or performance implications
  • Validate that the environment variable ENABLE_REORG_VALIDATION is correctly parsed and defaults to true across all configuration loading paths
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch np/reorg_val

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c890cda and ae30d72.

📒 Files selected for processing (3)
  • configs/config.go (1 hunks)
  • internal/committer/reorg.go (1 hunks)
  • internal/libs/clickhouse.go (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@nischitpra nischitpra merged commit a8cac5c into main Nov 3, 2025
4 of 6 checks passed
@nischitpra nischitpra deleted the np/reorg_val branch November 3, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants